<template>
  <div class="app-container">
    <div class="layout-content">
      <keep-alive v-if="$route.meta.keepAlive">
        <router-view></router-view>
      </keep-alive>
      <router-view v-else></router-view>
    </div>
    <div class="layout-footer">
      <TabBar :data="tabbars" @change="handleChange" />
    </div>
  </div>
</template>

<script>
import icon_shouye_normal from '@/assets/img/tabBar_icon/icon_shouye_normal@2x.png'
import icon_shouye_selected from '@/assets/img/tabBar_icon/icon_shouye_selected@2x.png'
import icon_ts_normal from '@/assets/img/tabBar_icon/icon_ts_normal@2x.png'
import icon_ts_selected from '@/assets/img/tabBar_icon/icon_ts_selected@2x.png'
import icon_wltc_normal from '@/assets/img/tabBar_icon/icon_wltc_normal@2x.png'
import icon_wltc_selected from '@/assets/img/tabBar_icon/icon_wltc_selected@2x.png'
import icon_kffw_normal from '@/assets/img/tabBar_icon/icon_kffw_normal@2x.png'
import icon_kffw_selected from '@/assets/img/tabBar_icon/icon_kffw_selected@2x.png'
import icon_wd_normal from '@/assets/img/tabBar_icon/icon_wd_normal@2x.png'
import icon_wd_selected from '@/assets/img/tabBar_icon/icon_wd_selected@2x.png'

import TabBar from '@/components/TabBar'
export default {
  name: 'AppLayout',
  data() {
    return {
      icon_shouye_normal,
      icon_shouye_selected,
      icon_ts_normal,
      icon_ts_selected,
      icon_wltc_normal,
      icon_wltc_selected,
      icon_kffw_normal,
      icon_kffw_selected,
      icon_wd_normal,
      icon_wd_selected,
      tabbars: [
        {
          title: '首页',
          to: {
            name: 'Home'
          },
          icon: icon_shouye_normal,
          icon_active: icon_shouye_selected
        },
        {
          title: '探索',
          to: {
            name: 'Shop'
          },
          icon: icon_ts_normal,
          icon_active: icon_ts_selected
        },
        {
          title: '网页套餐',
          to: {
            name: 'Wifi'
          },
          icon: icon_wltc_normal,
          icon_active: icon_wltc_selected
        },
        {
          title: '客房服务',
          to: {
            name: 'Room'
          },
          icon: icon_kffw_normal,
          icon_active: icon_kffw_selected
        },
        {
          title: '我的',
          to: {
            name: 'About'
          },
          icon: icon_wd_normal,
          icon_active: icon_wd_selected
        }
      ]
    }
  },
  components: {
    TabBar
  },
  methods: {
    handleChange(v) {
      console.log('tab value:', v)
    }
  }
}
</script>
<style lang="scss" scoped>
/deep/ {
  .van-tabbar{
    height:84px;
    box-sizing: border-box;
    padding-bottom:20px;
  }
}
.layout-content{
  padding-bottom:34px;
}
</style>
